package com.orkasgb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.orkasgb.entity.OrkasgbProjectEntity;
import com.orkasgb.mapper.OrkasgbProjectMapper;
import com.orkasgb.service.IOrkasgbProjectService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * 项目信息表(TOrkasgbProject)表服务实现类
 *
 * @version 1.0.0
 * @since 2024-09-08 21:17:21
 */
@Slf4j
@Service
public class OrkasgbProjectServiceImpl extends ServiceImpl<OrkasgbProjectMapper, OrkasgbProjectEntity> implements IOrkasgbProjectService {
	
	@Resource
	private OrkasgbProjectMapper orkasgbProjectMapper;
	
	/**
	 * 通过主键查询单条数据
	 *
	 * @param id 主键
	 * @return 单条数据
	 */
	@Override
	public OrkasgbProjectEntity getOrkasgbProject (Serializable id) {
		return this.getBaseMapper().selectById(id);
	}
	
	/**
	 * 通过条件查询多条数据
	 *
	 * @param orkasgbProjectEntity 实体查询参数
	 * @return 数据
	 */
	@Override
	public List<OrkasgbProjectEntity> getOrkasgbProjectList (OrkasgbProjectEntity orkasgbProjectEntity) {
		QueryWrapper<OrkasgbProjectEntity> queryWrapper = new QueryWrapper<>(OrkasgbProjectEntity.class);
		return this.getBaseMapper().selectList(queryWrapper);
	}
	
	/**
	 * 通过条件查询多条数据(分页查询)
	 *
	 * @param orkasgbProjectEntity 查询参数实体
	 * @return 数据
	 */
	@Override
	public IPage<OrkasgbProjectEntity> getOrkasgbProjectPageDataList (OrkasgbProjectEntity orkasgbProjectEntity) {
		QueryWrapper<OrkasgbProjectEntity> queryWrapper = new QueryWrapper<>(OrkasgbProjectEntity.class);
		IPage<OrkasgbProjectEntity> page = new Page<>(orkasgbProjectEntity.getCurrent(), orkasgbProjectEntity.getPageSize());
		return this.page(page, queryWrapper);
	}
	
	/**
	 * 新增数据
	 *
	 * @param orkasgbProjectEntity 实体对象
	 * @return 新增结果
	 */
	@Override
	public int addOrkasgbProject (OrkasgbProjectEntity orkasgbProjectEntity) {
		return this.getBaseMapper().insert(orkasgbProjectEntity);
	}
	
	/**
	 * 修改数据
	 *
	 * @param orkasgbProjectEntity 实体对象
	 * @return 修改结果
	 */
	@Override
	public int updateOrkasgbProject (OrkasgbProjectEntity orkasgbProjectEntity) {
		return this.getBaseMapper().updateById(orkasgbProjectEntity);
	}
	
	/**
	 * 修改或者新增数据
	 *
	 * @param orkasgbProjectEntityList 实体对象
	 * @return 操作结果
	 */
	@Override
	public int addOrUpdateOrkasgbProject (List<OrkasgbProjectEntity> orkasgbProjectEntityList) {
		return orkasgbProjectMapper.insertOrUpdateBatch(orkasgbProjectEntityList);
	}
	
	/**
	 * 删除数据
	 *
	 * @param idList 主键结合
	 * @return 删除结果
	 */
	@Override
	public int deleteOrkasgbProjectByIds (List<Long> idList) {
		return this.getBaseMapper().deleteByIds(idList);
	}
	
}

